// 网络封装类
import UIKit
import AFNetworking

class DKNetworkingTool: NSObject {
    
    
    // 网络管理单例
    static let sharedInstance: DKNetworkingTool = {
       let instance = DKNetworkingTool()
        return instance
    }()
    
    let manager :AFHTTPSessionManager = {
        let AFManager = AFHTTPSessionManager()
        AFManager.responseSerializer.acceptableContentTypes?.insert("text/plain")
        return AFManager
    }()
    
    func GetHttpClient(URLString: String,parameters: AnyObject?,progress: ((NSProgress) -> Void)?,success: ((NSURLSessionDataTask, AnyObject?) -> Void)?,failure: ((NSURLSessionDataTask?, NSError) -> Void)?) {
        
        manager.GET(URLString, parameters: parameters, progress: progress, success: success, failure: failure)
        
    }
    
    func POSTHttpClient(URLString: String,parameters: AnyObject?,progress: ((NSProgress) -> Void)?,success: ((NSURLSessionDataTask, AnyObject?) -> Void)?,failure: ((NSURLSessionDataTask?, NSError) -> Void)?) {
        
        manager.POST(URLString, parameters: parameters, progress: progress, success: success, failure: failure)
        
    }
    
    
}
